from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep

driver = webdriver.Firefox()
# 1.最大化浏览器窗口
driver.maximize_window()
driver.get('file:///D:/nsd2404/html/registerA.html')
# 2.设置为指定的大小，需要提供宽和高
# sleep(3)
# driver.set_window_size(800,600)
# 3.设置窗口位置
# sleep(3)
# driver.set_window_position(500, 200)
# 点击链接进入新浪
sleep(3)
driver.find_element(By.PARTIAL_LINK_TEXT, '新浪').click()
# 4.执行后退
sleep(3)
driver.back()
# 5.执行前进
sleep(3)
driver.forward()

sleep(3)
driver.quit()